package cn.lyf.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.index.Indexed;
import org.springframework.data.mongodb.core.mapping.DBRef;
import org.springframework.data.mongodb.core.mapping.Document;
import org.springframework.data.mongodb.core.mapping.Field;

import java.util.Collections;
import java.util.Date;
import java.util.List;

@Document("t_answer")
//评论
public class Answer {
    @Id
//    @Indexed
    private String id;
    private String nickname;//回答的用户昵称
    private String nickname2;//回复别人评论的用户昵称
    private String Content ; // 回答的内容
    private String Content2;//被回复的评论内容
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private Date  tcreate;//发表时间
    private String blogid;//评论的博客id
//    private String answerid;//回复评论的评论id
    @Field("answers")
    @DBRef
    private List<Answer> answers;

    public String getNickname() {
        return nickname;
    }

    public void setNickname(String nickname) {
        this.nickname = nickname;
    }

    public Date getTcreate() {
        return tcreate;
    }

    public void setTcreate(Date tcreate) {
        this.tcreate = tcreate;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getContent() {
        return Content;
    }

    public void setContent(String content) {
        Content = content;
    }

    public String getBlogid() {
        return blogid;
    }

    public void setBlogid(String blogid) {
        this.blogid = blogid;
    }

//    public String getAnswerid() {
//        return answerid;
//    }
//
//    public void setAnswerid(String answerid) {
//        this.answerid = answerid;
//    }

    public List<Answer> getAnswers() {
        return answers;
    }

    public void setAnswers(List<Answer> answers) {
        this.answers = answers;
    }

    public String getNickname2() {
        return nickname2;
    }

    public void setNickname2(String nickname2) {
        this.nickname2 = nickname2;
    }

    public String getContent2() {
        return Content2;
    }

    public void setContent2(String content2) {
        Content2 = content2;
    }

    @Override
    public String toString() {
        return "Answer{" +
                "id='" + id + '\'' +
                ", nickname='" + nickname + '\'' +
                ", nickname2='" + nickname2 + '\'' +
                ", Content='" + Content + '\'' +
                ", Content2='" + Content2 + '\'' +
                ", tcreate=" + tcreate +
                ", blogid='" + blogid + '\'' +
                ", answers=" + answers +
                '}';
    }
}
